package com.example.demo.controller;

import com.example.demo.pojo.UserInfo;
import com.example.demo.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author yanglup
 * @create 2020-12-12 20:07
 *
 * 后台管理平台   和小程序端公用一个server
 */
@Controller
public class BackUserInfoController {
    @Autowired
    UserInfoService userInfoService;

    @RequestMapping("/BackUserInfolist")
    public String BackUserInfolist(Model model) {
        List<UserInfo> list=userInfoService.BackUserInfolist();
        model.addAttribute("BackUserInfolists",list);
        Integer allnumber=userInfoService.BackUserInfolistnumber();
        model.addAttribute("allnumber",allnumber);
        return "BackUserInfolist";
    }

    /**删除用户*/
    @RequestMapping("/BackUserInfodelete")
    public String BackUserInfodelete(String openid){
        userInfoService.BackUserInfodelete(openid);
        return "redirect:/BackUserInfolist";
    }
//
//    /**通过id搜索商品*/
//    @RequestMapping("/Booksearch")
//    public String Booksearch(String goods_name, Model model){
//        List<Goodsaddguanli> booksearchlist=bookService.Booksearch(goods_name);
//        model.addAttribute("booksearchlists",booksearchlist);
//        Integer allnumber=bookService.Booksearchnumber(goods_name);
//        model.addAttribute("allnumber",allnumber);
//        return "Booklistquery";
//    }
}
